<?php
/**
 * @package    panel
 * @subpackage panel.environment
 */
/**
 * Shortcut/Helper class
 * @author Dmitry Bakaleinik (code)
 */
class panel
	implements maf__i__singletone {

	/**
	 * @return panel
	 */
	static public function getInstance() {

		static $instance;

		if( !isset($instance) ) {
			$instance = new self; }

		/**
		 * @var panel__db
		 */
		return $instance;

	}	# Function

	/**
	 * Shortcut to panel.application.console()
	 * @return unknown_type
	 */
	public function console() {

		$a = func_get_args();

		return call_user_func_array(
			array("panel__application", "console"),
			$a
		);

	}	# Function

	/**
	 * Shortcut to panel.db
	 * @return panel__db
	 */
	public function db() {

		return panel__db::getInstance();

	}	# Function

	/**
	 * Check value using multiple tests
	 * @throws panel__e__validation
	 * @param mixed          $_value_  (by ref)
	 * @param array|string   $_checks_ List of tests to perform
	 * @param string         $_name_   Field/Variable name
	 * @return mixed         $_value_  (by ref)
	 */
	public function validate(&$_value_, $_checks_ = array(), $_name_ = NULL) {

		return panel__validate::check($_value_, $_checks_, $_name_);

	}	# Function

	/**
	 * Check value using multiple tests (non-ref version)
	 * @throws panel__e__validation
	 * @param mixed          $_value_
	 * @param array|string   $_checks_ List of tests to perform
	 * @param string         $_name_   Field/Variable name
	 * @return mixed         $_value_  (by ref)
	 */
	public function validate_nr($_value_, $_checks_ = array(), $_name_ = NULL) {

		return panel__validate::check($_value_, $_checks_, $_name_);

	}	# Function

	/**
	 * @return panel__environment
	 */
	public function env() {

		return panel__environment::getInstance();

	}	# Function

}	# Class

/* EOF */